package v1

import (
	"gin-study/app/http/responses"
	"gin-study/app/services"
	"github.com/gin-gonic/gin"
	"github.com/spf13/cast"
)

var UserOrder = new(userOrder)

type userOrder struct {
	controller
}

func (this *userOrder) Index(c *gin.Context) interface{} {
	id := cast.ToUint(c.Param("id"))
	orders := services.UserOrder.GetUserOrders(id, this.GetPage(c))
	return responses.Ok("ok", gin.H{
		"orders": orders,
	})
}
